package com.heima.comment.controller;

import com.heima.comment.service.CommentRepayService;
import com.heima.model.comment.dto.CommentRepayDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @projectName: leadnews-project
 * @package: com.heima.comment.controller.v1
 * @className: CommentRepayController
 * @author: Eric
 * @description: TODO
 * @date: 2024/1/25 19:25
 * @version: 1.0
 */
@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {

    @Autowired
    private CommentRepayService commentRepayService;

    /**
     * 加载评论回复
     *
     * @param dto DTO
     * @return {@link ResponseResult}
     */
    @PostMapping("/load")
    public ResponseResult loadCommentRepay(@RequestBody CommentRepayDto dto){
        return commentRepayService.loadCommentRepay(dto);
    }

    /**
     * 保存回复评论
     *
     * @param dto DTO
     * @return {@link ResponseResult}
     */
    @PostMapping("/save")
    public ResponseResult saveCommentRepay(@RequestBody CommentRepayDto dto){
        return commentRepayService.saveCommentRepay(dto);
    }

    /**
     * 回复评论点赞
     *
     * @param dto DTO
     * @return {@link ResponseResult}
     */
    @PostMapping("/like")
    public ResponseResult likeCommentRepay(@RequestBody CommentRepayDto dto){
        return commentRepayService.likeCommentRepay(dto);
    }
}
